//
//  StatusRetweetedView.m
//  CC
//
//  Created by Calvin on 5/19/15.
//  Copyright (c) 2015 Calvin. All rights reserved.
//

#import "StatusRetweetedView.h"
#import "StatusRetweetedFrame.h"
#import "StatusModel.h"
#import "UserModel.h"
#import "UIImage+Extension.h"

@interface StatusRetweetedView()
@property (nonatomic,weak) UILabel *nameLabel;
@property (nonatomic,weak) UILabel *textLabel;
@end

@implementation StatusRetweetedView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.image = [UIImage resizedImage:@"timeline_retweet_background"];
        self.highlightedImage=[UIImage resizedImage:@"timeline_retweet_background_highlighted"];
        
        //NickName
        UILabel *nameLabel = [[UILabel alloc] init];
        nameLabel.textColor=CCColor(74, 102, 105);
        nameLabel.font = StatusRetweetedNameFont;
        [self addSubview:nameLabel];
        self.nameLabel = nameLabel;
        
        //text
        UILabel *textLabel = [[UILabel alloc] init];
        textLabel.font = StatusRetweetedTextFont;
        textLabel.numberOfLines=0;
        [self addSubview:textLabel];
        self.textLabel = textLabel;
    }
    return self;
}

-(void)setRetweetedFrame:(StatusRetweetedFrame *)retweetedFrame
{
    _retweetedFrame=retweetedFrame;
    
    StatusModel *retweeted_status = retweetedFrame.retweeted_status;
    self.frame = retweetedFrame.frame;
    
    self.nameLabel.text = [NSString stringWithFormat:@"@%@",retweeted_status.user.name];
    self.nameLabel.frame = retweetedFrame.nameFrame;
    
    self.textLabel.text = retweeted_status.text;
    self.textLabel.frame = retweetedFrame.textFrame;
    
}
@end
